<template>
	<view class="container">
		<view class="paging">
			<z-paging ref="paging" v-model="dataList" :auto="false" :fixed="false" @query="onQueryList">
				<view class="paging-item" v-for="(item,index) in dataList" :key="item.id" @click="toReport(item.id)">
					<view class="paging-item-t">
						<view class="title">
							<view class="label">体质偏向：</view>
							<view class="value">{{item.resultTitle}}</view>
						</view>
						<view class="feature">特征: {{item.advice}}</view>
					</view>
					<view class="paging-item-b">
						<view class="date">{{item.createTime}}</view>
					</view>
				</view>
			</z-paging>
		</view>
		
	</view>
</template>

<script>
	//引入请求文件
	import {listing} from '../../api/api.js'
	import {corporeityList} from '../../api/request.js'
	export default {
		data(){
			return{
				dataList:[]
			}
		},
		mounted() {
			this.$refs.paging.reload()
		},
		methods:{
			onQueryList(page, pageSize){
				uni.showLoading({title:'加载中'})
				listing(corporeityList+`?pageNum=${page}&pageSize=${pageSize}`)
				.then(res=>{
					if(res.data.code == 200){
						this.$refs.paging.complete(res.data.data?.list)
						uni.hideLoading();
					}else{
						this.$refs.paging.complete(false)
						this.$refs.uToast.show({
							type: 'error',
							message: res.data.msg
						})
						uni.hideLoading();
					}
				})
				.catch(err=>{
					uni.hideLoading();
				})
			},
			toReport(id){
				uni.navigateTo({
					url:'../../packagesAiPhoto/aiPhoto/bReport?id='+id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container{
		width: 100vw;
		height: 100vh;
		background: #F7F5F0;
		.paging{
			height: calc(100vh - 88rpx);
			padding: 30rpx 20rpx;
			&-item{
				background: #fff;
				border-radius: 24rpx;
				padding: 22rpx 32rpx;
				margin-bottom: 24rpx;
				font-weight: 400;
				box-sizing: border-box;
				&-t{
					padding-bottom: 28rpx;
					border-bottom: 2rpx solid #140F081A;
					.title{
						display: flex;
						align-items: center;
						margin-bottom: 12rpx;
						.label{
							font-size: 28rpx;
							color: #140F08B3;
						}
						.value{
							flex: 1;
							font-weight: bold;
							font-size: 32rpx;
							color: #FF702A;
							white-space: nowrap;
							overflow: hidden; 
							text-overflow: ellipsis;
						}
					}
					.feature{
						font-size: 28rpx;
						color: #140F08B3;
						line-height: 44rpx;
					}
				}
				&-b{
					font-size: 24rpx;
					color: #140F0880;
					margin-top: 24rpx;
				}
			}
		}
	}
</style>